<script setup lang="ts">
import { computed, ref } from 'vue';

import ProductSpec from './productspec/index.vue';
import SpacVTabel from './productspec/spacVTabel.vue';

const formState: any = defineModel();
const fulfillmentRule = computed(() => formState.value.rule?.fulfillmentRule);

const fahuomoshi = ref(1);
const fahuomos = ref(1);
const loding = ref(true);
const kucunjishu = ref(1);

setTimeout(() => {
  loding.value = false;
}, 500);
</script>

<template>
  <div>
    <a-spin
      :spinning="loding"
      class="mx-auto my-auto h-full w-full"
      size="large"
    />
    <a-form v-if="!loding" layout="vertical">
      <a-form-item
        v-if="0"
        :rules="[{ required: true, message: `该项为必填，请输入` }]"
        label="发货模式"
      >
        <a-radio-group v-model:value="fahuomoshi">
          <a-radio v-if="fulfillmentRule.normalRule.support" :value="1">
            现货发货模式
          </a-radio>
          <!-- <a-radio v-if="fulfillmentRule.stepRule.support" :value="2">
          阶梯发货模式
        </a-radio>
        <a-radio v-if="fulfillmentRule.productPresellRule.support" :value="3">
          全款预售发货模式
        </a-radio>
        <a-radio v-if="fulfillmentRule.skuPresellRule.support" :value="4">
          SKU预售发货模式
        </a-radio>
        <a-radio
          v-if="fulfillmentRule.timeSkuPresellWithNormalRule.support"
          :value="5"
        >
          现货+预售发货
        </a-radio>
        <a-radio
          v-if="fulfillmentRule.timeSkuPurePresellRule.support"
          :value="7"
        >
          新预售发货模式
        </a-radio> -->
        </a-radio-group>
      </a-form-item>
      <a-form-item
        v-if="fahuomoshi === 1 && 0"
        :rules="[{ required: true, message: `该项为必填，请输入` }]"
        label="现货发货时间"
      >
        <a-radio-group v-model:value="fahuomos">
          <a-radio :value="1"> 次日发 </a-radio>
          <a-radio :value="2"> 48小时 </a-radio>
          <a-radio :value="9999"> 当日发 </a-radio>
        </a-radio-group>
      </a-form-item>
      <a-form-item
        v-if="0"
        :rules="[{ required: true, message: `该项为必填，请输入` }]"
        label="订单库存计数"
      >
        <a-radio-group v-model:value="kucunjishu">
          <a-radio :value="1"> 下单减库存 </a-radio>
          <a-radio :value="2"> 付款减库存 </a-radio>
        </a-radio-group>
      </a-form-item>

      <a-form-item
        :rules="[{ required: true, message: `该项为必填，请输入` }]"
        label="商品规格"
      >
        <ProductSpec v-model="formState" />
      </a-form-item>
      <a-form-item
        :rules="[{ required: true, message: `该项为必填，请输入` }]"
        label="价格与库存"
      >
        <SpacVTabel v-model="formState" />
      </a-form-item>
    </a-form>
  </div>
</template>
